# coding: utf-8
from enum import Enum

from PySide6.QtGui import QImage, QPixmap
from qfluentwidgets import FluentIconBase, Theme, getIconColor
from .setting import SINGLE_ICON_DIR, ICON_DIR


class Icon(FluentIconBase, Enum):
    Conversion = 'Conversion'
    STOP = 'Stop'
    LOGO = 'Logo'
    SELECT = 'Select'

    def path(self, theme=Theme.AUTO) -> str:
        # return (ICON_DIR / f'{self.value}_{getIconColor(theme)}.svg').as_posix()
        return f':/edge-tts/image/icon/{self.value}_{getIconColor(theme)}.svg'


class SingleIcon(FluentIconBase, Enum):
    LOGO = 'logo.png'
    FEMALE = 'Female.svg'
    MALE = 'Male.svg'
    NO_DATA = 'NoData.svg'
    BG = 'bg.png'

    def path(self, theme=Theme.AUTO) -> str:
        # return (SINGLE_ICON_DIR / self.value).as_posix()
        return f':/edge-tts/image/single/{self.value}'

    def image(self):
        return QImage(self.path())

    def pixmap(self):
        return QPixmap(self.path())
